<script>
import Common from "@/mixins/order/common.js";
import OrderService from "@/api/order/OrderService.js";
import PPMForm from "@/crm3.0part7-ppm/core/ppmForm.vue";
import service from "../../../../utils/service";
import http from "../../../../utils/http";
export default {
  name: "hy5g10461100",
  mixins: [PPMForm, Common],
  data() {
    return {
      // proName: 'MSTP'
      QINAB: { qinA: "", qinB: "" },
    };
  },
  mounted() {
    this.init(); //初始化方法
    this.qryAccList();   
  },
  computed: {},
  methods: {
    //初始化方法  
    init() {
      this.formData['104324520'].disabled = true; 
      //租用性质 默认长期隐藏
      this.formData["TD_V_HIRE_KIND"].value = "80050002002";
      this.formData["TD_V_HIRE_KIND"].isshow = false;
      // 优先级 默认普通隐藏
      this.formData["ORDER_ITEM-PRIORITY"].value = "80050032001";
      this.formData["ORDER_ITEM-PRIORITY"].isshow = false;
      //集团受理时
      let orgId = this.user.orgId;


      this.formData["10461709-10000001380"].isshow = false; // 5G消息基础版IP地址 隐藏
      this.SetRequired({attrName:'5G消息基础版IP地址',formkey:'10461709-10000001380',reqName:'empty',reqStatus:false}); // 5G消息基础版IP地址 非必填
      this.formData["10461709-10000001381"].isshow = false; // 5G消息基础版审核结果回调地址 隐藏
      this.SetRequired({attrName:'5G消息基础版审核结果回调地址',formkey:'10461709-10000001381',reqName:'empty',reqStatus:false}); // 5G消息基础版审核结果回调地址 非必填
      this.formData["10461709-10000001382"].isshow = false; // 5G消息基础版状态报告回调地址 隐藏
      this.SetRequired({attrName:'5G消息基础版状态报告回调地址',formkey:'10461709-10000001382',reqName:'empty',reqStatus:false}); // 5G消息基础版状态报告回调地址 非必填
      this.formData["10461709-10000001383"].isshow = false; // 5G消息标准版IP地址 隐藏
      this.SetRequired({attrName:'5G消息标准版IP地址',formkey:'10461709-10000001383',reqName:'empty',reqStatus:false}); // 5G消息标准版IP地址 非必填
      this.formData["10461709-10000001384"].isshow = false; // 5G消息标准版回调地址 隐藏
      this.SetRequired({attrName:'5G消息标准版回调地址',formkey:'10461709-10000001384',reqName:'empty',reqStatus:false}); // 5G消息标准版回调地址 非必填
      this.formData["10461709-10000001385"].isshow = false; // 5G消息标准版平台登录地址 隐藏
      this.SetRequired({attrName:'5G消息标准版平台登录地址',formkey:'10461709-10000001385',reqName:'empty',reqStatus:false}); // 5G消息标准版平台登录地址 非必填
    },

    //收款单位 业务发起地默认发起地   
    async qryAccList() {
      let params = {
        interFaceType: "ORDER",
        sqlId: 2021070901,
        paramStr: "orgId:" + this.user.orgId,
      };
      
      const result = await OrderService.executeSql(params);
      if (result.code == 200) {
        if (result.meta.resList.executeSqlResps.length > 0) {
          //收款单位
          this.formData["10461703-100010007"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10461703-100010007"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
         //业务发起地
         this.formData["10461709-142002194"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10461709-142002194"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
        }
      }
    },
    async getInputGridValue(obj) {
      let key = obj["key"];
      if(key=="10461709-142002194"){
        let date = obj["data"];
        var param = {
          orgId: this.user.orgId,
          accountCode: date["accountUnitCode"]
        };
      const result = await OrderService.checkAccountByorgId(param);
      if (result.code == 200) {
            var meta = result.meta;
           if (meta.resultCode != 0) {
                this.$message({
                message: meta.resultMsg,
                showClose: true,
              });    
              this.formData["10461709-142002194"].value ="";
              this.formData["10461709-142002194"].text  =""  ;
           }
       }
      }

    },
    //客户接入码  每一个客户必须唯一
    async checkCustInputNum() {
      let val =this.formData["10461709-10000001372"].value;
      let params = {
        interFaceType: "ORDER",
        sqlId: 2021081802,
        paramStr: "custId:" + this.orderPosInfo.custId+";attrId:10000001372"+";attrValue:"+val,
      };

      const result = await OrderService.executeSql(params);
      if (result.code == 200) {
        if (result.meta.resList.executeSqlResps.length > 0) {
              this.$message({
                message: "同客户的“客户接入码”不可重复",
                showClose: true,
              });
              this.formData["10461709-10000001372"].value= "";
        }
      }
    },

    //客户(CSP) 名称  每一个客户必须唯一
    async checkCustInputNum1() {
      let val =this.formData["10461709-10000001373"].value;
      let params = {
        interFaceType: "ORDER",
        sqlId: 2021081802,
        paramStr: "custId:" + this.orderPosInfo.custId+";attrId:10000001373"+";attrValue:"+val ,
      };
      const result = await OrderService.executeSql(params);
      if (result.code == 200) {
        if (result.meta.resList.executeSqlResps.length > 0) {
              this.$message({
                message: "同客户的“客户（CSP）名称”不可重复",
                showClose: true,
              });
              this.formData["10461709-10000001373"].value= "";
        }
      }
    },

    // 产品类型
    cpType(val) {
      if(val.indexOf('1000') != -1 && val.indexOf('1001') == -1){
            this.formData["10461709-10000001380"].isshow = true; // 5G消息基础版IP地址 显示
            this.SetRequired({attrName:'5G消息基础版IP地址',formkey:'10461709-10000001380',reqName:'empty',reqStatus:true}); // 5G消息基础版IP地址 必填
            this.formData["10461709-10000001381"].isshow = true; // 5G消息基础版审核结果回调地址 显示
            this.SetRequired({attrName:'5G消息基础版审核结果回调地址',formkey:'10461709-10000001381',reqName:'empty',reqStatus:true}); // 5G消息基础版审核结果回调地址 必填
            this.formData["10461709-10000001382"].isshow = true; // 5G消息基础版状态报告回调地址 显示
            this.SetRequired({attrName:'5G消息基础版状态报告回调地址',formkey:'10461709-10000001382',reqName:'empty',reqStatus:true}); // 5G消息基础版状态报告回调地址 必填
            this.formData["10461709-10000001383"].isshow = false; // 5G消息标准版IP地址 隐藏
            this.SetRequired({attrName:'5G消息标准版IP地址',formkey:'10461709-10000001383',reqName:'empty',reqStatus:false}); // 5G消息标准版IP地址 非必填
            this.formData["10461709-10000001384"].isshow = false; // 5G消息标准版回调地址 隐藏
            this.SetRequired({attrName:'5G消息标准版回调地址',formkey:'10461709-10000001384',reqName:'empty',reqStatus:false}); // 5G消息标准版回调地址 非必填
            this.formData["10461709-10000001385"].isshow = false; // 5G消息标准版平台登录地址 隐藏
            this.SetRequired({attrName:'5G消息标准版平台登录地址',formkey:'10461709-10000001385',reqName:'empty',reqStatus:false}); // 5G消息标准版平台登录地址 非必填
        }else if(val.indexOf('1000') != -1 && val.indexOf('1001') != -1){
            this.formData["10461709-10000001380"].isshow = true; // 5G消息基础版IP地址 显示
            this.SetRequired({attrName:'5G消息基础版IP地址',formkey:'10461709-10000001380',reqName:'empty',reqStatus:true}); // 5G消息基础版IP地址 必填
            this.formData["10461709-10000001381"].isshow = true; // 5G消息基础版审核结果回调地址 显示
            this.SetRequired({attrName:'5G消息基础版审核结果回调地址',formkey:'10461709-10000001381',reqName:'empty',reqStatus:true}); // 5G消息基础版审核结果回调地址 必填
            this.formData["10461709-10000001382"].isshow = true; // 5G消息基础版状态报告回调地址 显示
            this.SetRequired({attrName:'5G消息基础版状态报告回调地址',formkey:'10461709-10000001382',reqName:'empty',reqStatus:true}); // 5G消息基础版状态报告回调地址 必填
            this.formData["10461709-10000001383"].isshow = true; // 5G消息标准版IP地址 显示
            this.SetRequired({attrName:'5G消息标准版IP地址',formkey:'10461709-10000001383',reqName:'empty',reqStatus:true}); // 5G消息标准版IP地址 必填
            this.formData["10461709-10000001384"].isshow = true; // 5G消息标准版回调地址 显示
            this.SetRequired({attrName:'5G消息标准版回调地址',formkey:'10461709-10000001384',reqName:'empty',reqStatus:true}); // 5G消息标准版回调地址 必填
            this.formData["10461709-10000001385"].isshow = true; // 5G消息标准版平台登录地址 显示
            this.SetRequired({attrName:'5G消息标准版平台登录地址',formkey:'10461709-10000001385',reqName:'empty',reqStatus:true}); // 5G消息标准版平台登录地址 必填
        }else if(val.indexOf('1000') == -1 && val.indexOf('1001') != -1){
            this.formData["10461709-10000001383"].isshow = true; // 5G消息标准版IP地址 显示
            this.SetRequired({attrName:'5G消息标准版IP地址',formkey:'10461709-10000001383',reqName:'empty',reqStatus:true}); // 5G消息标准版IP地址 必填
            this.formData["10461709-10000001384"].isshow = true; // 5G消息标准版回调地址 显示
            this.SetRequired({attrName:'5G消息标准版回调地址',formkey:'10461709-10000001384',reqName:'empty',reqStatus:true}); // 5G消息标准版回调地址 必填
            this.formData["10461709-10000001385"].isshow = true; // 5G消息标准版平台登录地址 显示
            this.SetRequired({attrName:'5G消息标准版平台登录地址',formkey:'10461709-10000001385',reqName:'empty',reqStatus:true}); // 5G消息标准版平台登录地址 必填
            this.formData["10461709-10000001380"].isshow = false; // 5G消息基础版IP地址 隐藏
            this.SetRequired({attrName:'5G消息基础版IP地址',formkey:'10461709-10000001380',reqName:'empty',reqStatus:false}); // 5G消息基础版IP地址 非必填
            this.formData["10461709-10000001381"].isshow = false; // 5G消息基础版审核结果回调地址 隐藏
            this.SetRequired({attrName:'5G消息基础版审核结果回调地址',formkey:'10461709-10000001381',reqName:'empty',reqStatus:false}); // 5G消息基础版审核结果回调地址 非必填
            this.formData["10461709-10000001382"].isshow = false; // 5G消息基础版状态报告回调地址 隐藏
            this.SetRequired({attrName:'5G消息基础版状态报告回调地址',formkey:'10461709-10000001382',reqName:'empty',reqStatus:false}); // 5G消息基础版状态报告回调地址 非必填
        }else{
            this.formData["10461709-10000001380"].isshow = false; // 5G消息基础版IP地址 隐藏
            this.SetRequired({attrName:'5G消息基础版IP地址',formkey:'10461709-10000001380',reqName:'empty',reqStatus:false}); // 5G消息基础版IP地址 非必填
            this.formData["10461709-10000001381"].isshow = false; // 5G消息基础版审核结果回调地址 隐藏
            this.SetRequired({attrName:'5G消息基础版审核结果回调地址',formkey:'10461709-10000001381',reqName:'empty',reqStatus:false}); // 5G消息基础版审核结果回调地址 非必填
            this.formData["10461709-10000001382"].isshow = false; // 5G消息基础版状态报告回调地址 隐藏
            this.SetRequired({attrName:'5G消息基础版状态报告回调地址',formkey:'10461709-10000001382',reqName:'empty',reqStatus:false}); // 5G消息基础版状态报告回调地址 非必填
            this.formData["10461709-10000001383"].isshow = false; // 5G消息标准版IP地址 隐藏
            this.SetRequired({attrName:'5G消息标准版IP地址',formkey:'10461709-10000001383',reqName:'empty',reqStatus:false}); // 5G消息标准版IP地址 非必填
            this.formData["10461709-10000001384"].isshow = false; // 5G消息标准版回调地址 隐藏
            this.SetRequired({attrName:'5G消息标准版回调地址',formkey:'10461709-10000001384',reqName:'empty',reqStatus:false}); // 5G消息标准版回调地址 非必填
            this.formData["10461709-10000001385"].isshow = false; // 5G消息标准版平台登录地址 隐藏
            this.SetRequired({attrName:'5G消息标准版平台登录地址',formkey:'10461709-10000001385',reqName:'empty',reqStatus:false}); // 5G消息标准版平台登录地址 非必填
        }
    },
 
  },
};
</script>

